package be.colwri.client;

public class RemoveCommand extends Command {
/**
	 * 
	 */
	private static final long serialVersionUID = -1400163632629754240L;
private int position;
public void setPosition(int position) {
	this.position = position;
}

public void setLength(int typed) {
	this.length = typed;
}
private int length;

   private RemoveCommand() {
	   
   }

   
   public RemoveCommand (int pos, int typ) {
	   setLength(typ);
	   setPosition(pos);
   }
   
   
	@Override
	public void doorstuurCommand(Command cmnd) {
		// TODO Auto-generated method stub
     cmnd.recalculateCommand(this);
	}

	@Override
	public String execute(String execstr) {
		// TODO Auto-generated method stub
		if (getPosition()+ 1 < execstr.length()) {
		    return execstr.substring(0, getPosition() - 1) + execstr.substring(getPosition());
		}
		else {
			return execstr.substring(0, getPosition() - 1);
		}
	}

	@Override
	public int getPosition() {
		// TODO Auto-generated method stub
		return position;
	}

	public int getLength() {
		// TODO Auto-generated method stub
		return length;
	}
}
